package cn.edu.xmu.orderpayment.order.microservice;

import cn.edu.xmu.oomall.core.util.Common;
import cn.edu.xmu.oomall.core.util.ReturnObject;
import cn.edu.xmu.orderpayment.order.microservice.vo.*;
import cn.edu.xmu.privilegegateway.annotation.util.InternalReturnObject;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import static cn.edu.xmu.privilegegateway.annotation.util.Common.cloneVo;

/**
 * @author Li Yixuan 22920192204232
 * @create: 2021/12/24
 */
@FeignClient(value = "other-service")
public interface CustomerService {
    @ApiOperation(value = "买家查看自己信息")
    @GetMapping("/internal/customers/{id}")
    InternalReturnObject<SimpleCustomerRetVo> getCustomerById(@PathVariable("id") Long id);

    /**
     * 使用优惠券消费后，修改优惠券状态为已使用
     */
    @PutMapping("/internal/coupons/{id}/use")
    ReturnObject useCoupon(@RequestParam Long userId, @RequestParam String userName, @PathVariable Long id);


    /**
     * 退款后，修改优惠券状态为已领取
     */
    @PutMapping("/internal/coupons/{id}/refund")
    ReturnObject refundCoupon(@RequestParam Long userId, @RequestParam String userName, @PathVariable Long id);

    @PutMapping("/internal/point/{customerId}")
    InternalReturnObject<CustomerModifyPointsVo> changeCustomerPoint(@PathVariable Long customerId, @RequestBody CustomerModifyPointsVo vo);


    @ApiOperation("查询优惠券是否存在且状态为未使用")
    @GetMapping("/internal/coupons/{id}/exists")
    ReturnObject isCouponExists(@PathVariable Long id, @RequestParam Long userId);
}
